﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using TCKQKL.FrontEnd.Config;
using TCKQKL.FrontEnd.DataModel;
using TCKQKL.Service.LookupClient;

namespace TCKQKL.FrontEnd.Web.Controls
{
    public partial class BankAccount : System.Web.UI.UserControl
    {
        public List<BankDataUI> banks = new List<BankDataUI>();

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string userid = HttpContext.Current.User.Identity.Name;
                if (userid == "")
                {
                    HttpCookie authcookie = Request.Cookies[FormsAuthentication.FormsCookieName];
                    if (authcookie == null)
                    {
                        FormsAuthentication.SignOut();
                        Response.Redirect(Settings.URL_PAGE_LOGIN);
                    }
                    FormsAuthenticationTicket ticket = (FormsAuthenticationTicket)FormsAuthentication.Decrypt(authcookie.Value);
                    userid = ticket.Name;
                }
                LSClient client = new LSClient();
                banks = client.getBankDataByInvestorId(client.getAccountData(HttpContext.Current.User.Identity.Name).investorId);
                client.Close();

            }
            catch
            {
                return;
            }
        }
    }
}